package com.sgcc.system.api.factory;

import com.sgcc.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.system.api.RemoteDeptService;
import com.sgcc.system.api.domain.SysDept;

import feign.hystrix.FallbackFactory;

import java.util.List;

/**
 * 用户部门服务降级处理
 * 
 * @author sgcc
 */
@Component
public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteDeptFallbackFactory.class);

    @Override
    public RemoteDeptService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteDeptService()
        {

			@Override
			public AjaxResult getInfoIsc(String deptId) {
				// TODO Auto-generated method stub
				return AjaxResult.error("获取部门信息失败请稍后在试~");
			}

			@Override
			public AjaxResult addIsc(SysDept dept) {
				// TODO Auto-generated method stub
				return AjaxResult.error("ISC插入部门信息失败，请稍后在试~");
			}

			@Override
			public AjaxResult editIsc(SysDept dept) {
				// TODO Auto-generated method stub
				return AjaxResult.error("ISC更新部门信息失败，请稍后在试~");
			}

			@Override
			public AjaxResult getAll() {
				// TODO Auto-generated method stub
				return AjaxResult.error("获取部门列表失败~");
			}

			@Override
			public R getUnit(String deptId) {
				return null;
			}

			@Override
			public R getSubordinateUnit(String deptId) {
				return null;
			}

			@Override
			public R<SysDept> getDeptById(String deptId) {
				return R.fail();
			}

			@Override
			public R getCityAndQuXianBySheng(String deptId) {
				return null;
			}

			@Override
			public R getAllCityAndDistrictInfo() {
				return null;
			}

		};
    }
}
